Repository navigation
chore(deps): bump libs/nistcurves v0.11.2 → v0.14.0, gate the P-384 objects, and place the growth - #216
Merged
Conversation
…rowth
v0.13.0 carries the fail-closed fix for the defect we reported upstream
(c64-nist-curves#148): the Lim-Lee comb accepted an unusable anchor-table
slot and ecdsa_verify returned VALID on the collapsed u1*G = O case.
c64-https-uci-comb.prg is a shipped product on that path
(LIB_NISTCURVES_REU_BANKS_USED = $0004, measured).
Keep the scope exact. The guard catches a COLLAPSED anchor table, not a
CORRUPT one. An attacker who can write REU bank 2 plants a valid point
instead, reaches a forged R with Z != 0 throughout, and no post-condition
on the result would see it. This is not a defence against that attacker.
v0.12.0 adds the SPEC 8.2 REU DMA settle across thirteen sites, and that
is where the bytes went:
LIB_NISTCURVES_MUL_CODE 123 -> 162 (+39, nistcurves_reu_dma_wait)
LIB_NISTCURVES_P256_CODE 8304 -> 8362 (+58 onchip; +82 REU; +100 comb)
ABI 2 -> 4 (v0.13.0 gave ec_scalar_mul a carry return; v0.14.0 fixed
reu_fetch_mul_row to take the row index in A per 8.2). Neither hop
reaches our call surface: we never jsr ec_scalar_mul into the library
(src/crypto/ecdsa_verify.s defines its own shim) and we never call the
fetch. src/crypto/ecdsa_verify.s needs no change -- it asserts MAJOR = 0
and MINOR >= 9, both still true.
PLACEMENT. Measured, literal ld65, against the five configurations:
uci-onchip 'LIB_NISTCURVES_P256_RODATA' overflows 'CRYPTO_HOT' by 22 bytes
uci REU default same segment, same region, by 59 bytes
uci-comb links (CRYPTO_HOT 93 free)
ip65 REU default links (CRYPTO_RESIDENT 29 free)
The fix routes LIB_NISTCURVES_P256_RODATA -- 192 B of curve/mod constants
-- from CRYPTO_HOT to CRYPTO_OVERLAY in cfg/c64-https-uci.cfg. One line,
one cfg, no source change, and cfg/c64-https-uci-onchip.cfg has routed
the same segment the same way since the comb profile existed, so the
shipped comb image is untouched. CRYPTO_OVERLAY is plain resident RAM at
$4200-$5FFF under UCI with ~2 KB free in both affected profiles, it is
where LIB_NISTCURVES_MUL_CODE already lives, and rodata there is subject
to nothing the cold-shadow zero-fill does. Post-fix CRYPTO_HOT margins:
170 B uci-onchip, 133 B uci REU default.
Rejected: moving LIB_NISTCURVES_MUL_CODE instead (it is not the segment
that overflows under UCI, and it already lives in CRYPTO_OVERLAY there);
and enlarging CRYPTO_HOT, which cannot grow past $A000 without landing
under boot's zbss zero-fill.
ip65-onchip is NOT fixed by this commit and still fails to link
('LIB_NISTCURVES_MUL_CODE' overflows 'CRYPTO_RESIDENT' by 57 bytes). It
needs a decision outside a pin bump -- see the PR body.
Suites, both matching their pre-bump baseline:
tools/test_ecdsa_kat_oracle.py 6/6 (3 valid accepted, 3 invalid rejected)
tools/test_x25519.py 73/73
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…scope it tools/integration/build_nistcurves_p256.sh proves LIB_NO_BARE_EXPORTS=1 reached the archive by od65-ing the discovered zp_config*.o member for an export of the bare `zp_ptr2`. libs/nistcurves v0.14.0 (upstream #154, SPEC 6.1 member isolation) moved the deprecated bare aliases out of zp_config.s into src/zp_aliases.s -> member zp_aliases_p256verify.o / _p256comb.o. From that pin, zp_config*.o exports no bare alias WHETHER OR NOT the flag took effect: the guard passed by reading an object that could no longer fail. That matters because this failure has NO link error. CLAUDE.md records the mechanism: a member built with a different knob string re-exports names the rest of the archive suppressed, one artifact carrying two configurations, dormant until a second contract library enters the link. Retargeted at every member of the archive rather than at the new member name, so the next re-homing cannot repeat this. Members are read from upstream's build directory exactly as the ZP slot checks already do -- listing an archive and reading the objects it names is not extraction, so 6.1 stays clean. A member the archive names but that is absent is a hard error, and a zero-member scan is a hard error, because a guard that silently scans nothing is the very shape being fixed. RED-GREEN, measured in this worktree at the v0.14.0 pin: GREEN, as shipped: $ bash tools/integration/build_nistcurves_p256.sh onchip [p256/onchip] ZP overrides verified in zp_config_p256verify.o; bare zp_* suppressed across 18 members rc=0 RED, same script with ` -D LIB_NO_BARE_EXPORTS=1` stripped from CONTRACT_DEFINES: ERROR: these archive members re-export the bare 'zp_ptr2' — LIB_NO_BARE_EXPORTS did not reach them: zp_aliases_p256verify.o One archive must carry one configuration (SPEC 6.2). rc=1 VACUITY of the old guard, on that same un-suppressed archive: $ od65 --dump-exports libs/nistcurves/build/zp_config_p256verify.o \ | grep -c '"zp_ptr2"' 0 <- old guard passes $ od65 --dump-exports libs/nistcurves/build/zp_aliases_p256verify.o \ | grep '"zp_ptr2"' Name: "zp_ptr2" The ZP_MEMBER discovery itself survives the pin unchanged: `ar65 t | grep '^zp_config'` still matches exactly one member, since zp_aliases_*.o does not share the prefix. Also in this file, since both are the same staleness: the pinned-version string in the c64-https#124 preflight diagnostic is now RESOLVED from the gitlink with `git describe --tags --exact-match` instead of carrying a hand-edited literal (it still said v0.11.2 -- a wrong version inside a message aimed at version staleness), and the ">= v0.11.2" floor block now lists the v0.12.0/v0.13.0/v0.14.0 reasons, including the #148 scope caveat. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ured margins Pin prose: the >= v0.11.2 build rule and the `libs/nistcurves@v0.11.2` line in Crypto ABI move to v0.14.0, with the new floor reasons pointed at the CONTRACT_DEFINES block that actually lists them. Adds the ABI = 4 fact and the #148 comb fail-closed fix, the latter with its scope stated exactly: it catches a COLLAPSED anchor table, not a CORRUPT one, and is no defence against an attacker who can write REU bank 2. Three margins this file carried were wrong, all measured here: CRYPTO_HOT under UCI claimed 81 B, is per-profile: 170 / 93 / 133 at v0.14.0 (36 / 193 / 23 at v0.11.2, so the 81 was already stale -- issue #193) comb CRYPTO_OVERLAY tail claimed ~223 B, is 120 B (159 at v0.11.2) ip65 free blocks claimed ~170-186 B NET_CODE and 16 B LOADER, are 56 B (beyond the 20 B the default target strings use) and 21 B The ip65 paragraph also gains the fact that makes its headroom arithmetic decidable: CRYPTO_OVERLAY ($4F8C-$5FFF) and CRYPTO_RESIDENT ($6000-$9FFF) are ADJACENT, so they are one 20,596 B pool and shuffling segments between them creates nothing. That is why the contiguous-region restructure is worth only the 22 B of boundary fragmentation, and why "route the library segment elsewhere" is not a general answer on ip65: the other free blocks are NET_CODE's tail, which is the HTTPS_HOST/HTTPS_PATH budget, and the smallest segment in the pool is 169 B. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The flag's `CA65FLAGS += -D ENABLE_P384_VERIFY=1` was nested inside `ifeq ($(USE_NISTCURVES_ONCHIP),1)`, so the two REU-profile builds — plain `make` and `make BACKEND=uci` — dropped it silently. Setting the flag on those two configurations produced a PRG byte-identical to the unflagged one. Red/green, PRG sha256, at the parent commit: make BACKEND=ip65 d780f719fac82e07bba9d30db804e853 make BACKEND=ip65 ENABLE_P384_VERIFY=1 d780f719fac82e07bba9d30db804e853 make BACKEND=uci 7c79a4e00a19685de7540970247c759a make BACKEND=uci ENABLE_P384_VERIFY=1 7c79a4e00a19685de7540970247c759a After this commit those two armed builds move to cbfd9d9b1155447f and 8b67ee949f8507b8 — the flag now does what it says on every profile. This matters because ENABLE_P384_VERIFY exists solely so the P-384 safety gate can be mutation-tested (CLAUDE.md, "Crypto ABI"). A mutation control that is a no-op on 2 of 5 configurations proves nothing about those two. The three onchip profiles were never affected by the nesting, and their armed PRGs are byte-identical across this move: BACKEND=ip65 USE_NISTCURVES_ONCHIP=1 b9f03169ababe20b (both) BACKEND=uci USE_NISTCURVES_ONCHIP=1 3c2712629063de69 (both) BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 cc555c196a8b1673 (both) All five UNARMED PRGs are unchanged by this commit; no shipped image moves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit f73bbc04d3b746de189caae74f3688a681044498)
ecdsa_verify_384.o was in every shipped image and reachable from none of
them. Its sole export, ecdsa_verify_384_tls, is imported only from inside
ecdsa_verify.s's `.ifdef ENABLE_P384_VERIFY`; ca65 emits no import record
for an unreferenced .import, so the object was pulled in purely because
the wildcard named it on the ld65 command line.
Deadness evidence (not read off the source gate):
- od65 --dump-imports build/crypto/ecdsa_verify.o does not list
ecdsa_verify_384_tls.
- The string ecdsa_verify_384_tls appears in ZERO Imports-list entries
across all five build/c64-https.map files (ip65-onchip, uci-onchip,
uci-comb, plain ip65, plain uci).
- Its own imports (crypto_swap_to_p384_{sha384,curve},
ecdsa_pubkey_{x,y}_384, tls_rec_buf, tls_transcript) all come from
objects linked for other reasons, so dropping it resolves nothing away.
- ec_scalar_mul_384_shim lives in the P-384 CURVE ARCHIVE, which the main
link never names; it is unaffected.
- p384_force_link.s was already inert (`.ifdef USE_NISTCURVES_P384`,
undefined today) and contributes 0 B either way.
Recovered, per build (PRG sha256 before -> after):
ip65-onchip ba2be108 -> 7b953a8e CRYPTO_OVERLAY 22 -> 321 B free
CRYPTO_RESIDENT 40 -> 73 B free
uci-onchip 5f9e9fb9 -> f0a85c18 NET_CODE 67 -> 366 B free
CRYPTO_HOT 36 -> 69 B free
uci-comb c4234760 -> 4a184fdb NET_CODE 67 -> 366 B free
CRYPTO_OVERLAY 159 -> 192 B free
plain-ip65 d780f719 -> 0a85a1ff CRYPTO_OVERLAY 22 -> 321 B free
CRYPTO_RESIDENT 150 -> 183 B free
plain-uci 7c79a4e0 -> 18c26f5b NET_CODE 67 -> 366 B free
CRYPTO_HOT 23 -> 56 B free
plus 2 B of BSS in each (the cold-shadow gap below TABLES_BSS goes 44 -> 46 B).
Behaviour is unchanged: the P-384 arm was already a `sec` reject, and it
still is. Red/green on the mutation control, uci-onchip, after this commit:
ENABLE_P384_VERIFY unset tools/test_p384_overlay_hazard.py exit 0
"0 / 7680 bytes changed, C=1, PASS"
ENABLE_P384_VERIFY=1 tools/test_p384_overlay_hazard.py exit 1
"5575 / 7680 changed, DID NOT RETURN (hung)"
so the gate is still provably load-bearing. tools/test_tls_p384_negotiation.py
is 2/2 before and after; tools/test_ecdsa_p384_kat.py exits 1 with
"required artifact missing: build/labels-p384-sha384.txt" before and after
(the P-384 overlay build has never completed - see "Known issues").
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit d64067754c96ace0d7367521ef5ab972e2729aad)
ip65 was the odd one out. cfg/c64-https-uci.cfg:252 and cfg/c64-https-uci-onchip.cfg:297 have always routed HTTP_AUX_CODE2 to CRYPTO_OVERLAY, next to the HTTP_AUX_CODE slice it was split off from; only cfg/c64-https-ip65.cfg sent it to the CRYPTO_RESIDENT tail. Its own comment gave the reason: "CRYPTO_OVERLAY cannot hold the whole W4 machinery on ip65". That precondition is gone. Gating the unreachable P-384 objects out of the link (previous commit) returned 299 B of CRYPTO_AUX_CODE + 33 B of CRYPTO_RODATA to every image, and CRYPTO_OVERLAY on ip65 now has room for the 169 B slice. So this is not a new trade-off being taken; it retires a workaround whose cause has been removed, and leaves all three cfgs agreeing on where the W4 helper slice lives. Measured on the integrated branch (ip65-onchip, BACKEND=ip65 USE_NISTCURVES_ONCHIP=1): CRYPTO_OVERLAY $4F8C-$5FFF top $5F67 152 B free CRYPTO_RESIDENT $6000-$9FFF top $9F6E 145 B free Without this move the same build overflows CRYPTO_RESIDENT by 57 B at the libs/nistcurves v0.14.0 pin; with it, both regions link with margin. The stale comment is replaced with what is now true. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three things changed under this file's feet:
- ENABLE_P384_VERIFY now applies on all five profiles (it was nested
inside the USE_NISTCURVES_ONCHIP block and silently dropped by the two
REU builds), and it is now the ONLY thing that links
src/crypto/ecdsa_verify_384.s and src/crypto/p384_force_link.s. The
entry gains that command, because it is the one build that can still
catch a P-384 symbol going away — and a warning that assembling the
file proves nothing: `.import` of an undefined symbol is a LINK-time
error in ca65, so `ca65 src/crypto/ecdsa_verify_384.s` succeeds with
every import unresolved.
- The Crypto ABI section records what gating costs: exactly two symbols,
crypto_swap_to_p384_sha384 and crypto_swap_to_p384_curve, lose their
only link-time consumer. Read off the Imports list of all five
build/c64-https.map files, not estimated. Both are still exported
unconditionally by crypto_swap.s and still occupy bytes.
- The ip65 headroom paragraph is re-measured at the v0.14.0 pin with the
gate and the HTTP_AUX_CODE2 move in place: 152 B CRYPTO_OVERLAY,
145 B CRYPTO_RESIDENT, 56 B NET_CODE tail, 21 B LOADER, 43 B below
TABLES_BSS. The adjacency argument it already carried is what settled
the bump, so it now says so: 20,631 B of content against 20,596 B of
pool, 35 B short however the segments are arranged.
The ip65 memory map also gains HTTP_AUX_CODE + HTTP_AUX_CODE2 in
CRYPTO_OVERLAY's tenant list.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
b313b5f measured these at the v0.14.0 pin, before the P-384 objects were gated out of the link, and e4fda6d refreshed only the ip65 numbers. The 33 B of CRYPTO_RODATA that gating returned lands in a different region per profile, so the correction is asymmetric: CRYPTO_HOT uci-onchip 170 -> 203 CRYPTO_HOT uci REU default 133 -> 166 CRYPTO_OVERLAY uci-comb 120 -> 153 Comb's CRYPTO_HOT is the one that does NOT move: it stays 93 B, because cfg/c64-https-uci-onchip.cfg already routes CRYPTO_RODATA to CRYPTO_OVERLAY, so comb's 33 B came back there instead. That asymmetry is now stated at both sites rather than left for the next reader to rediscover -- it is the third time in this branch that a per-profile figure has been corrected in one profile and left stale in the others. All three replacements are measured from build/c64-https.map on this branch, not derived from the 33 B. Docs only. No PRG changes; all five profile hashes are unchanged from d7e8592, re-verified after this commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An adversarial sweep of EVERY free/margin/hole figure in this file against five measured maps -- rather than only the hunks this branch touched -- found six wrong. 807d5a6 fixed three; these are the other four, two of which made the file contradict itself. Self-contradictions, both now resolved to the measured value: LOADER free on ip65 :307 said 58 B, :683 said 21 B -> 21 B comb CRYPTO_OVERLAY :511 said 223 B, :650 said 120 B -> 153 B Six hundred lines apart in a file every session reads start to finish, and a file that contradicts itself is worse than one uniformly stale: it makes whichever number you happened to read feel confirmed. Both sites now say which is current and point at the Memory layout section, and the 58 B and 223 B are kept as dated history rather than deleted, since both were true when written (#142 and the server-name-validation episode respectively). Plain staleness: smallest segment in the ip65 pool 169 B -> 162 B 169 B is HTTP_AUX_CODE2. The smallest is LIB_NISTCURVES_MUL_CODE at 162 B, read off build/c64-https.map. The conservation conclusion is unaffected -- 162 > 56, so the NET_CODE tail still cannot absorb the smallest pool segment -- but the number naming it was wrong, and this is the sentence a future restructure would lean on. Also: :517's "at v0.11.2 it was 36 / 193 / 23" is CORRECT and stays. It was flagged as unverifiable because the v0.11.2 pin is no longer reachable from this branch (it fails the branch's own ABI assert). It is measurable on master at 48657f5, where the baseline lane measured exactly those three values before this work began, so the line now says where to check it. A figure that cannot be re-derived from the tree that carries it needs its provenance written down, not removing. Docs only. `git diff --name-only` is CLAUDE.md alone; no PRG changes, and all five profile hashes are re-verified unchanged from d7e8592 after this commit. Not squashed into d7e8592 or earlier, so the two in-flight e2e runs remain valid. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…file hazard Two additions, both from an adversarial review of this branch. 1. PACKAGE_VARIANTS. The file said restoring a REU-profile image is "one line in PACKAGE_VARIANTS", framed purely as curation. Measured LIB_NISTCURVES_REU_BANKS_USED across all five builds: ip65-onchip $0000 uci-onchip $0000 uci-comb $0004 plain-ip65 $0003 plain-uci $0003 The shipped onchip products touch no REU bank and uci-comb claims bank 2, which is what the exposure argument for this bump rests on. But the two REU profiles read $0003 -- they DO library REU DMA, so they are exposed to the SPEC 8.2 REU DMA settle fix that libs/nistcurves v0.12.0 added. Restoring that one line therefore restores an image with a security-relevant dependency on the pin, and nothing said so. Now it does. 2. A maintenance hazard on the margin figures themselves. The recurring defect in this file is not that a number goes stale; it is that a number gets corrected in the ONE profile someone was looking at and left stale in the other four. Three instances in this bump alone, two of which left the file contradicting itself hundreds of lines apart -- which is worse than uniform staleness, because the reader who lands on either site sees a file that agrees with itself. The note says to re-measure all five off build/c64-https.map rather than deriving the rest by arithmetic, and gives the worked reason: the deltas are NOT uniform. Gating returned 33 B of CRYPTO_RODATA to CRYPTO_HOT in three profiles but to CRYPTO_OVERLAY in comb, because comb's cfg routes that segment differently -- so an "add 33 everywhere" pass would have been wrong in exactly one place, and that place is the shipped product. Docs only. `git diff --name-only` is CLAUDE.md alone; five hashes re-verified unchanged after this commit. Not squashed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
README was untouched by this branch and carried figures and claims the bump falsifies. All numbers below are measured on this branch's tip with `make clean` between products, read off `build/c64-https.map`. - The nistcurves pin is v0.14.0, not v0.11.2. The comb verify sweep is re-attributed to the v0.11.2 pin, where it was taken. - Free-space table re-measured for all three products. Every cell moved, and not uniformly, so the paragraph under it now says to read them per profile: ip65 CRYPTO_OVERLAY 22 -> 152 B and CRYPTO_RESIDENT 40 -> 145 B, UCI NET_CODE 67 -> 366 B (the 299 B of CRYPTO_AUX_CODE the unreachable P-384 object held), uci-onchip CRYPTO_OVERLAY 2,035 -> 1,804 B (LIB_NISTCURVES_P256_RODATA moved there), uci-comb CRYPTO_HOT 193 -> 93 B. The two CRYPTO_COLD_SHADOW cells also lose a byte: 44 / 1,578 were measured from the last used address, not the first free one, while every other cell in the same table was not. - Label counts: 2,398/2,729/2,864 -> 2,395/2,726/2,859. PRG sizes are unchanged at 47,105 / 62,977 / 62,977, which is the point that section already makes about size not being a measurement. - P-384 is now gated at the link line too (332 B recovered), and ENABLE_P384_VERIFY applies on all five profiles rather than being silently dropped by the REU ones — issue #207. - Restoring a REU-profile image in PACKAGE_VARIANTS is flagged as a security-relevant decision, with the measured LIB_NISTCURVES_REU_BANKS_USED per product ($0000 onchip, $0004 comb, $0003 for the two unshipped REU profiles). The wikipedia claims are corrected rather than softened. The release blurb and the Project Status entry both presented a 125,235 B byte-checked fetch; that does not reproduce on either tree. http_get returns carry=0 / HTTP 200 on bodies tens of kilobytes short of their Content-Length, intermittently — issue #211, which the README now cites in three places, along with #210 for why the rig on that path could not go red on it. The entry also states what has NOT been tested: ip65 against a large body, at any size. The handshake conclusions are left standing; only the body path is in question. Two facts in that block are owned by more than one branch, so they land here as the later branch in the merge order. Documentation only; no source, cfg or Makefile change on top of this branch, so no PRG hash moves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ount Two corrections to the free-space paragraph, both from adversarial review. Every value in the table above it survived; this is prose. 1. The claimed off-by-one never happened. This commit's parent said the old 44 / 1,578 CRYPTO_COLD_SHADOW cells had been measured from the last used address while the rest of the table was not. They were not: master measured under the same convention as the rest of the table yields 44 / 1,578, so the old cells were right. The byte is real segment growth at the v0.14.0 pin — a 3 B LIB_NISTCURVES_BSS appears and BSS shrinks by 2, walking CRYPTO_BSS's last address $B9D3 -> $B9D4 on ip65 and $B3D5 -> $B3D6 under UCI — which is a fact about the bump and worth stating in its own right. Worth naming what happened here: a correct measurement with a wrong story attached to it, written into the very paragraph that corrects other people's figures. It is the defect this branch documents, committed while documenting it. 2. "Every cell moved, and not by a common factor" was contradicted by the table printed directly above: ip65 LOADER and NET_CODE, uci-onchip LOADER, and both NET_BSS_TAIL cells are unchanged. Replaced with the claim that actually holds (the reasons do not generalise across profiles), and the four static cells are now named — an unchanged number is not evidence that a region was left alone. Documentation only; no PRG hash moves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two review findings, both about claims that are true only in a context the README did not state. - The wikipedia entry cited three live body counts and an offline reproduction, all device runs, without naming an image. It now says #211 carries the PRG sha256 of each, and why a commit does not substitute for one. Three products ship from this tree; the three live counts are three different PRGs. - The ip65 memory map's `+ HTTP_AUX_CODE2` is true because this branch's parent moved that segment in cfg/c64-https-ip65.cfg. On the other three branch trees it still rides the CRYPTO_RESIDENT tail, so the line is order-dependent and now says so, and says to read the cfg. Documentation only; no PRG hash moves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
JC-000
force-pushed
the
chore/crypto-lib-bump
branch
from
September 7, 2026 20:38
22904d6 to
f982504
Compare
The End-to-end HTTPS status section claimed the 125,235 B article was byte-verified. It does not reproduce on either tree: `http_get` returns carry=0 / http_status=200 on bodies tens of kilobytes short of their Content-Length, intermittently and not as a function of size. Measured offline against a local listener with Content-Length and no chunking (25,557 / 78,293 / 160,000 B at a constant 160,000 B request, plus one run that hung), and live at 117,192 / 89,526 / 73,720 B against a same-day 125,703 B curl anchor. README already carried this correction; CLAUDE.md did not. That asymmetry — a figure fixed where someone was looking and left stale in the canonical file — is the same shape as the six margin figures this branch corrects, and CLAUDE.md is the file read first each session. The handshake and GET results in that paragraph are unaffected; only the body-completeness claim is withdrawn. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
The
libs/nistcurvesv0.11.2 -> v0.14.0 bump, plus the two changes that letip65 link at that pin: gating the unreachable P-384 objects out of the link,
and converging
HTTP_AUX_CODE2ontoCRYPTO_OVERLAYon ip65 so all threecfgs agree.
The commits:
ec4e478LIB_NISTCURVES_P256_RODATAtoCRYPTO_OVERLAYunder UCI91242d7b313b5f76826a1377d969ENABLE_P384_VERIFYout of theUSE_NISTCURVES_ONCHIPblock (cherry-picked,-x)f9ad178ENABLE_P384_VERIFY(cherry-picked,-x)d7e8592HTTP_AUX_CODE2toCRYPTO_OVERLAYon ip65 — required for ip65 to link, and convergent with both uci cfgse4fda6d807d5a6948542b6ef5e7dWhy ip65 could not be made to link by moving segments — the conservation proof
CRYPTO_OVERLAY($4F8C-$5FFF, 4,212 B) andCRYPTO_RESIDENT($6000-$9FFF,16,384 B) are adjacent. They are therefore one pool of 20,596 B, and
nothing that only moves segments between them creates space.
At the v0.14.0 pin, before gating, that pool had to hold 20,631 B of
content. It is 35 B short, however the segments are arranged. The 57-byte
LIB_NISTCURVES_MUL_CODEoverflow ld65 reported is one arrangement's symptom,not the size of the problem, and chasing it by shuffling segments could only
ever relocate the overflow.
The cross-check that proves it. Pre-gating,
CRYPTO_OVERLAYhad 22 Bfree while
CRYPTO_RESIDENToverflowed by 57 B.57 - 22 = 35— the pooldeficit, exactly. That single subtraction is why the 57 B
ld65reports is asymptom rather than the problem, and why no cfg-only fix could exist: the 22 B
on the near side of the boundary was the most any reshuffle could ever donate,
and it was 35 B short.
(The 22 B is pin-invariant, which is worth knowing when reading it: ip65's
CRYPTO_OVERLAYholds only our own code —TLS_CODE1,852 +CRYPTO_AUX_CODE1,571 +
HTTP_AUX_CODE468 +HTTP_AUX_CODE2169 = 4,060 of 4,212 post-gating.Every library segment routed there is 0 B in the shipped map. The two segments
v0.14.0 actually grew,
LIB_NISTCURVES_P256_CODEandLIB_NISTCURVES_MUL_CODE,both land in
CRYPTO_RESIDENT.)So the fix had to remove content.
ecdsa_verify_384.o— in every shippedimage, reachable from none of them — was 332 B of it. Removing it leaves
20,299 B in a 20,596 B pool.
The
HTTP_AUX_CODE2move is load-bearing, not tidying. Gating alone doesnot make ip65 link: with the P-384 objects gone and the segment still in
CRYPTO_RESIDENT,LIB_NISTCURVES_MUL_CODEstill overflows that region — by24 B, measured, not 57. The move is what closes the last 24 B, by putting
169 B on the side of the boundary that has room. Two separate claims, and only
the first is optional-sounding:
BACKEND=ip65 USE_NISTCURVES_ONCHIP=1doesnot link at the v0.14.0 pin.
cfg/c64-https-uci.cfg:252and
cfg/c64-https-uci-onchip.cfg:297have always routed the segment toCRYPTO_OVERLAY; ip65 was the odd one out, and its own comment said the splitexisted because "CRYPTO_OVERLAY cannot hold the whole W4 machinery on ip65" —
which gating made untrue. So it retires a workaround whose precondition is
gone rather than introducing a new trade-off.
The convergence is the reason the move is safe. It is not the reason it is
there.
The 332 B, measured on this tree
ec4e478)NET_CODEfree, all three UCI buildsCRYPTO_AUX_CODE)CRYPTO_HOTfree, uci-onchipCRYPTO_RODATA)CRYPTO_HOTfree, plain uci299 + 33 = 332. The pre-gating column is
ec4e478's own measurements on thisbranch, so the delta is ours end to end, not inherited.
What gating costs, exactly
Two symbols lose their only link-time consumer. Measured from the
Imports listofbuild/c64-https.map, armed (make BACKEND=uci ENABLE_P384_VERIFY=1,PRG
a4974836…):One importer each, the same object, and in all five unarmed builds neither
symbol appears in any Imports-list entry. Both remain exported unconditionally
by
crypto_swap.sand still occupy bytes; nothing else changes.Attribution: synthesising #206
#206 is right about the number and wrong about where it comes from.
CRYPTO_RESIDENToverflow reproduces exactly onthis tree. Confirmed.
NET_CODE366 -> 408 does not. On our treeNET_CODEis an ip65 region with a different tenancy, and 366 B is thepost-gating UCI figure, not an ip65 one.
LIB_NISTCURVES_MUL_CODE123 -> 162 (+39, thenistcurves_reu_dma_waitfrom SPEC 8.2) plus
LIB_NISTCURVES_P256_CODE8304 -> 8362 (+58 onchip).Both read off
build/c64-https.mapat the v0.14.0 pin:MUL_CODEis$00A2= 162 B andP256_CODEis$20AA= 8,362 B in the ip65-onchip map.Same 57 B, different derivation. Cite ours.
Exposure — which shipped product is actually at risk
v0.14.0 carries two upstream fixes. Only one product is exposed to either.
c64-https-ip65-onchip.prgc64-https-uci-onchip.prgc64-https-uci-comb.prgThe table's underpinning, measured rather than asserted.
LIB_NISTCURVES_REU_BANKS_USEDacross all five builds:$0000$0000$0004$0003$0003This adds a consequence the exposure table did not previously carry: the two
REU profiles read
$0003— they do library REU DMA and are exposed to thev0.12.0 settle fix. They ship in nothing today, but CLAUDE.md records that
restoring them is "one line in
PACKAGE_VARIANTS". That line is therefore asecurity-relevant decision, not merely a curation one, and nothing said so.
6ef5e7dwrites it into CLAUDE.md at thePACKAGE_VARIANTSnote.uci-combis the only image on the Lim-Lee comb path(
LIB_NISTCURVES_REU_BANKS_USED = $0004, measured) and the only one doinglibrary REU DMA. Keep the scope exact: the v0.13.0 guard catches a collapsed
anchor table, not a corrupt one. An attacker who can write REU bank 2 plants
a valid point instead and no post-condition on the result would see it. This is
not a defence against that attacker.
Builds — all five link
7905d63c8141816d1e5258c9d40850769667f7eb8753c503a2665ca941b8345c30dd30a5fde7df1b1e00738c1b441cdfbdb75016a17e1bf331b93ae68ef9960df85e37123166188c7f4364b531ee1661aa9a22da6639025c360e896f47260993ca74bffb4e8a700d3322c8d566ba8b401794f5cf77094ba651750fb96fb5382fc2d74d70d376d65e97a9e3b9c23c243324b8d9e4ec244f969621321d8d7e1329Trap for anyone re-deriving these tables:
uci-onchiplinks againstcfg/c64-https-uci.cfg, NOTcfg/c64-https-uci-onchip.cfg. OnlyUSE_NISTCURVES_ONCHIP_COMBretargets$(CFG); plainUSE_NISTCURVES_ONCHIPkeeps the base cfg. Reading the region table against the wrong cfg attributes
RODATAandCRYPTO_RODATAtoCRYPTO_OVERLAYwhen they are actually inCRYPTO_HOT, and yields a negative free count — which is how it was caughthere. Confirm the cfg from the
ld65 -Cline in the build log, never from theprofile name. That is exactly what the CLAUDE.md rule exists for.
Per-region free bytes (tail free = region end minus the top of the last segment
ld65 placed there;
CRYPTO_COLD_SHADOWis reported as its internal hole belowthe
$BA00-pinnedTABLES_BSS, since its tail is always 0 by construction):ip65-onchip (
cfg/c64-https-ip65.cfg) — the build this PR unblocksBoth predicted margins confirmed exactly: 152 B
CRYPTO_OVERLAY, 145 BCRYPTO_RESIDENT.plain-ip65 (REU profile, same cfg)
uci-onchip (
cfg/c64-https-uci.cfg— note the base cfg, not-onchip)plain-uci (REU profile, same cfg)
uci-comb (
cfg/c64-https-uci-onchip.cfg)Tests — re-run on the integrated branch, every hash moved
Each result names the artifact it ran against.
test_ecdsa_kat_oracle.pyC64_MAKE_ARGS="BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1" C64_INIT_TIMEOUT=900f85e3712…test_ecdsa_kat_oracle.pyca74bffb…test_x25519.pyca74bffb…test_p384_overlay_hazard.pyBACKEND=uci USE_NISTCURVES_ONCHIP=1 ENABLE_P384_VERIFY=1c16423ba…test_p384_overlay_hazard.pyBACKEND=uci ENABLE_P384_VERIFY=1a4974836…test_p384_overlay_hazard.pyBACKEND=uci(control)c2d74d70…test_tls_p384_negotiation.pymake(default ip65 REU)ca74bffb…pytest -qmake BACKEND=ucic2d74d70…check_upstream_pins.py --worktree† This row was not independently reproduced. The adversarial review re-ran
the other two hazard rows (
a4974836…and thec2d74d70…control) and confirmedthem exactly; it did not run this one. It rests on this lane's measurement alone
and should not be read as double-checked.
The comb PRG the KAT ran against,
f85e3712…, is byte-identical to thepackaged
c64-https-uci-comb.prg:tools/package/_common.sh:27builds thatproduct from exactly
BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1. Coverage namesits artifact, and this is the artifact.
Red/green on
377d969make BACKEND=uci ENABLE_P384_VERIFY=1now producesa4974836…whilemake BACKEND=uciproducesc2d74d70…. Different bytes. Before the hoistthose two builds were byte-identical, which is how
test_p384_overlay_hazard.pypassed on the two REU profiles while exercising an unflagged image — a mutation
control that was a no-op on 2 of 5 configurations. It is now red on all of them,
and green with the flag off. Arguably the more valuable result in this PR than
the 57 bytes it was opened for.
Pin state
One figure that came out different from prediction
Reported as measured rather than adjusted to match.
Cold-shadow hole is 43 B on ip65, not 46 B.
d640677's commit messagerecords the gap below
TABLES_BSSgoing 44 -> 46 B. At the v0.14.0 pin onthis tree it is 43 B on both ip65 builds — measured on
ip65-onchipandplain-ip65alike. The pin moved under that figure.The wrong number is left standing in the commit message on purpose, and it
is not the only stale figure in there. Both cherry-picked commits
(
377d969,f9ad178) retain their original pre-bump measurements verbatim —f9ad178's message alone carries five PRG hashes and ten free-byte figurestaken on a v0.11.2 tree, none of which reproduces here;
ip65-onchipat thatcommit does not even link. Cherry-pick policy is to preserve a message as
written, and correcting any of it would rewrite the commits and move the branch
tip past
e4fda6d…, which two hardware/e2e lanes are already pointed at. Thetables in this PR supersede every measurement in both cherry-picked messages.
Cite them, not the commit bodies.
Two disclosures about the commits themselves
d7e8592's commit message says the ip65 overflow is 57 B. It is 24 B at thatpoint, and the message is wrong. 57 B is the overflow before the P-384
gating; by the time
d7e8592applies, gating has already returned 33 B toCRYPTO_RESIDENTand the remaining deficit is 24. Measured directly — revertingjust the cfg line on the current tree and linking gives:
Not corrected in place, for the same reason as
d640677's 46 B:d7e8592isthe last artifact-touching commit, and rewriting it would change the SHA two
in-flight e2e runs were dispatched against. Cite 24 B, from here.
The branch is not bisectable for ip65:
BACKEND=ip65 USE_NISTCURVES_ONCHIP=1does not link at any commit before
d7e8592. The bump lands first (57 Boverflow), gating narrows it (24 B), and only the cfg move closes it. That
ordering is deliberate — each commit is one reviewable idea — but it means
anyone bisecting an ip65 problem across this range will hit a run of
non-building commits and reasonably conclude they broke something. They did
not. The two UCI profiles link at every commit; only ip65 has the gap.
A note on test totals
pytestcollects 131 on this branch and 133 onchore/x25519-v0.16.0,which adds a two-test module (
tools/test_x25519_pin.py, registered inpytest.ini). Both are correct. A pytest total is a property of the tree,not of the suite, and quoting one without naming the tree invites a phantom
regression — which is what nearly happened here.
This is not a figure that failed. It is a correct number that belongs to a
different configuration, which is a different thing entirely and worth keeping
distinct in a PR whose subject is not mis-attributing causes.
CLAUDE.md already records the same trap one layer down, for
test_x509_name.py:"its vector count is conditional — never quote one without the condition." The
pytest total has it too. Name the tree, or do not quote the number.
Rejected alternatives
CRYPTO_OVERLAYandCRYPTO_RESIDENTon ip65.Cannot work: the regions are adjacent, so they are one pool, and the pool was
35 B short however arranged. This is the whole point of the conservation proof.
CRYPTO_RESIDENT. It cannot grow past$A000without landingunder
boot.s's zbss zero-fill.LIB_NISTCURVES_MUL_CODEinstead. It is not the segment thatoverflows under UCI, and it already lives in
CRYPTO_OVERLAYthere.correctness fix, to avoid removing 332 B of code no image can reach.
the retired
EMBED_P256_OVERLAYfollows. Gating is reversible in one flag andkeeps the mutation control alive; deletion would remove the only build that
can still catch a P-384 symbol going away.
HTTP_AUX_CODE2's move as a new trade-off. It is not one.cfg/c64-https-uci.cfg:252andcfg/c64-https-uci-onchip.cfg:297have alwaysrouted that segment to
CRYPTO_OVERLAY. ip65's own comment said it livedelsewhere because "CRYPTO_OVERLAY cannot hold the whole W4 machinery on ip65"
— gating made that untrue, so the workaround retires and the stale comment
goes with it.
NO HARDWARE OR E2E RUN HAS COVERED THESE IMAGES
Every PRG hash in this PR is new. Nothing that ran before this branch covers
anything it produces:
covered a different
ip65-onchipbinary. It does not cover7905d63c….the banner rig, the bad-Finished rig — covered different
uci-onchipanduci-combbinaries. They do not cover30dd30a5…orf85e3712….was touched by this lane.
The last commit that can change a built artifact is
d7e8592. Everything afterit —
e4fda6d,807d5a6,948542b— is CLAUDE.md-only(
git diff --name-only d7e8592..HEADreturnsCLAUDE.mdand nothing else), andall five profiles were rebuilt at the tip and came back bit-identical to the
hashes tabulated above. An e2e run pointed at any commit from
d7e8592forwardis measuring the same bytes.
Provenance note for the hardware write-ups. The two e2e lanes were dispatched
against
e4fda6d, which is no longer the tip. Their results still stand — theartifacts are identical — but this project's standing rule is that a hardware
claim names its artifact, so those write-ups must cite the PRG sha256
alongside the commit, not the commit alone. A commit SHA stops identifying an
image the moment a docs commit lands on top of it; the hash does not.
That is this PR's recurring defect one level up: an identifier that was
accurate when it was recorded and silently stopped being.
d640677's 46 B,f9ad178's five hashes and ten margins,d7e8592's 57 B, and the six stalefigures in CLAUDE.md are all the same shape — every one of them was true when
written. Nothing here was ever a careless measurement; they went stale because
the tree moved underneath them and nothing tied them to the tree they described.
Hence the rule this PR applies throughout, and asks the hardware lanes to apply
too: name the artifact, not the commit.
uci-combis the one product exposed to either defect and the one whose cryptopath changed most; it has had no hardware run at these bytes. Treat hardware
and e2e coverage as owed, not carried over.
🤖 Generated with Claude Code